<?

require_once "core.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holiday_references.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holiday_special_offers.php";


$holiday_references = new holiday_references;
$holiday_special_offers = new holiday_special_offers();

$current_specials = $holiday_special_offers->get_specials();
	
if(!empty($current_specials)){

foreach($current_specials as $special_values){

	// Get Holiday values
	$params['reference_id'] = $special_values['reference_id'];
	$holiday_values = $holiday_references->search_holiday_reference($params);
	unset($params);

	if($holiday_values['departure_date']<=date('ymd')){
	
		// Delete Offer
		$params['special_offer_id'] = $special_values['special_offer_id'];
		$holiday_special_offers->delete_special_offer($params);
		unset($params);
		
		// Delete holiday reference
		$params['reference_id'] = $holiday_values['reference_id'];
		$holiday_references->delete_reference($params);
		unset($params);
	
	}


}

}
